package io;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;


public class Entrada {
	private BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
	public Entrada(){}
	public int getOpcion(){

		int respuesta = 0;
		try {
			respuesta = Integer.parseInt(stdIn.readLine());
		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return respuesta;
	}
	public String leerCadena(){
		try {
			return (String)stdIn.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}
	public void pausa(){
		try {
			new BufferedReader(new InputStreamReader(System.in)).readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
	@SuppressWarnings("unchecked")
	public HashMap leerFicheroER(String ruta){
		
		HashMap hm = new HashMap();
		String linea = "";
		try {
			BufferedReader bf = new BufferedReader(new FileReader(ruta));
			while ((linea = bf.readLine())!=null) {
				StringTokenizer stk = new StringTokenizer(linea);
				boolean first = true;
				String er = "";
				String token = "";
				while (stk.hasMoreTokens()){
					String cadena = stk.nextToken();

					if (!first){
						er = cadena;
						hm.put(token, er);
						first = true;
					}else{
						token = cadena;
						first = false;
					}
					
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return hm;
	}
}
